package com.dilip;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Add
 */
public class Add extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Add() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		//intWriter out=response.getWriter();
		
		 response.setContentType("text/html;charset=UTF-8");
		 PrintWriter out = response.getWriter();
		// String name = request.getParameter("name");
		 String a = request.getParameter("num1");
		 String b = request.getParameter("num2");
		 int sum = 0;
		 int x,y;
		 x = Integer.parseInt(a);
		 y = Integer.parseInt(b);
		 sum = x + y;
		 out.println("Hi!The sum is" + sum);
		 out.close();
		 }
	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
